<template>
  <div class="company-job-post">
    <Table
      ref="table"
      :searchData="searchData"
      :service="services.search"
      @selection-change="handleSelectionChange"
    >
      <template #tools>
        <div class="toolbar">
          <el-button
            type="primary"
            icon="el-icon-upload2"
            size="small"
            @click="handleDownload"
          >
            {{ $t('action.export') }}
          </el-button>
          <el-input
            class="search-input"
            size="small"
            placeholder="请输入用户名"
            v-model="searchData.keyword"
          >
            <el-button
              slot="append"
              icon="el-icon-search"
              @click="search"
            ></el-button>
          </el-input>
        </div>
      </template>
      <el-table-column prop="postDate" :label="$t('job.postDate')" />
      <el-table-column prop="studentName" :label="$t('job.studentName')" />
      <el-table-column prop="jobTags" :label="$t('job.jobTags')" />
      <el-table-column prop="sex" :label="$t('field.sex')" />
      <el-table-column prop="age" :label="$t('field.age')" />
      <el-table-column prop="degree" :label="$t('field.degree')" />
      <el-table-column prop="timeLengthStr" :label="$t('resume.timeLength')" />
      <el-table-column prop="timeLengthStr" label="任务数/及格数/驳回数">
        <template slot-scope="scope">
          {{ scope.row.taskCount }}/{{ scope.row.passCount }}/{{
            scope.row.rejectCount
          }}
        </template>
      </el-table-column>
      <TableColumnEnum
        prop="employStatus"
        :label="$t('job.employStatus')"
        enumType="EMPLOY_STATUS"
      />
      <TableColumnAction v-slot="{ scope }">
        <el-button
          type="primary"
          size="mini"
          round
          @click="
            $router.push('/company/job-list/post/resume-detail/' + scope.row.id)
          "
          >查看简历</el-button
        >
      </TableColumnAction>
    </Table>
  </div>
</template>

<script>
import { crudMixin } from 'mixins'
import { Table, TableColumnEnum, TableColumnAction } from 'components'
import { searchJobPost, downloadJobPost } from 'services/company/job'
export default {
  name: 'CompanyJobPost',
  components: {
    Table,
    TableColumnEnum,
    TableColumnAction
  },
  mixins: [crudMixin],
  data() {
    return {
      services: {
        search: searchJobPost,
        download: downloadJobPost
      }
    }
  },
  created() {
    this.searchData.jobId = this.$route.query.id
  }
}
</script>
